package com.meibei.ljl.test01;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

/**
 * Created by xy on 16/9/23.
 */
public class TitleLayout extends LinearLayout {
    private LinearLayout back, share;
    private LayoutInflater inflater;

    public TitleLayout(Context context, AttributeSet attrs) {
        super(context);
        inflater.from(context).inflate(R.layout.title, this);
        back = (LinearLayout) findViewById(R.id.title_back);
        share = (LinearLayout) findViewById(R.id.title_share);
        back.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getContext(), "你点击了返回按钮", Toast.LENGTH_SHORT).show();
            }
        });
        share.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getContext(), "你点击了分享按钮", Toast.LENGTH_SHORT).show();
            }
        });
    }
}
